import unittest

from parameterized import parameterized

from api.xihrm_login_api import XihrmLoginApi
from common.xassert_util import xassert_util

from common.xread_json_util import read_json
from config import BASE_DIR


class TestIhrmLogin(unittest.TestCase):
    path_filename = BASE_DIR + "/data/ihrm_login.json"

    @parameterized.expand(read_json(path_filename))
    def test_login(self, desc, req_data, stauts_code, success, code, message):
        resp = XihrmLoginApi.login(req_data)
        print(desc, resp.json())
        xassert_util(self, resp, stauts_code, success, code, message)
